from django.db import models

# Create your models here.


class Product(models.Model):
    name = models.CharField(max_length=20)
    stock = models.IntegerField()
    sales = models.IntegerField()


class Orders(models.Model):
    order_id = models.IntegerField()
    comment = models.CharField(max_length=100)
    status = models.CharField(max_length=10)


class UserProfile(models.Model):
    username = models.CharField(max_length=20, null=False, unique=True, db_index=True)
    password = models.CharField(max_length=32, null=False)
    email = models.EmailField()
    phone = models.CharField(max_length=11, null=False)
    is_active = models.BooleanField(null=False, default=False)
    create_time = models.DateTimeField(auto_now_add=True)
    updated_time = models.DateTimeField(auto_now=True)


class SKU(models.Model):
    name = models.CharField(max_length=50, null=False)
    price = models.DecimalField(max_digits=10, decimal_places=2, null=False, default=0.0)
    stock = models.IntegerField()
    sales = models.IntegerField()
    is_launched = models.BooleanField(null=False, default=True)
    created_time = models.DateTimeField(auto_now_add=True)
    updated_time = models.DateTimeField(auto_now=True)
